{extend name="layout/layout" /}

{block name="pagecss"}
<link href="__STATIC__/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" />
{/block}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark"></i>
                    <span class="caption-subject font-dark bold uppercase"> 编辑网点</span>
                </div>
                <div class="actions">
                    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
                </div>
            </div>
            <div class="portlet-body">
                <form id="ajax-form" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        网点名称
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" id="name" data-required="1" name="name" data-name="{$info.name}" maxlength="80" value="{$info.name}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        所在地
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div class="form-inline">
                                            <input type="hidden" class="cityId" value="{$info.cityId}">
                                            <input type="hidden" class="xianId" value="{$info.xianId}">
                                            <input type="hidden" class="townId" value="{$info.townId}">
                                            <input type="hidden" class="villageId" value="{$info.villageId}">
                                            {include file="common:selectarea" /}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        地址<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" id="address" value="{$info.address|default=''}" class="form-control input-large margin-bottom" name="address" placeholder="请输入详细地址，带省市">
                                        <input type="text" id="add-text1" style="display:none" value="" class="form-control input-large" name="addressGeo">
                                        <br />
                                        <div style="width:100%;height:300px;" id="map_container"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        封面图
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div id="upload-image">
                                            <span id="upload-btn" data-multi="false">
                                                <input type="hidden" class="form-control" id="coverImg"  name="coverImg" value="{$info.imgUrl}">
                                                <img src="{$info.imgUrl|default='__STATIC__/admin/img/default.png'}" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                        <span class="help-block"> (建议尺寸：750*500) </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        网点图片
                                    </label>
                                    <div class="col-md-9">
                                        <div id="cover-image">
                                            {foreach name="imagesList" item="images"}
                                            <span class="multi-image">
                                                <input type="hidden" name="imgIds" value="{$images.id}">
                                                <input type="hidden" name="imgUrl" value="{$images.imgUrl}">
                                                <img class="exist-image" src="{$images.imgUrl}" alt="">
                                                <img class="del" src="__STATIC__/pages/image/del.png" alt="">
                                            </span>
                                            {/foreach}
                                            <span id="upload-cover-btn" data-multi="true" data-field="imgUrls">
                                                <!--<input type="hidden" class="form-control" id="imgUrl" data-required="1" name="imgUrl" value="">-->
                                                <img src="__STATIC__/admin/img/default.png" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                        <span class="help-block"> (建议尺寸：750*457) </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        营业时间
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9" style="margin-top: 10px;">
                                        <label class="mt-checkbox" style="width: 80px;">
                                            <input type="checkbox" name="openWeek" value="1" {if condition="(in_array(1, $info.openWeek))"} checked {/if}> 周一
                                            <span></span>
                                        </label>
                                        <label class="mt-checkbox" style="width: 80px;">
                                            <input type="checkbox" name="openWeek" value="2" {if condition="(in_array(2, $info.openWeek))"} checked {/if}> 周二
                                            <span></span>
                                        </label>
                                        <label class="mt-checkbox" style="width: 80px;">
                                            <input type="checkbox" name="openWeek" value="3" {if condition="(in_array(3, $info.openWeek))"} checked {/if}> 周三
                                            <span></span>
                                        </label>
                                        <label class="mt-checkbox" style="width: 80px;">
                                            <input type="checkbox" name="openWeek" value="4" {if condition="(in_array(4, $info.openWeek))"} checked {/if}> 周四
                                            <span></span>
                                        </label>
                                        <label class="mt-checkbox" style="width: 80px;">
                                            <input type="checkbox" name="openWeek" value="5" {if condition="(in_array(5, $info.openWeek))"} checked {/if}> 周五
                                            <span></span>
                                        </label>
                                        <label class="mt-checkbox" style="width: 80px;">
                                            <input type="checkbox" name="openWeek" value="6" {if condition="(in_array(6, $info.openWeek))"} checked {/if}> 周六
                                            <span></span>
                                        </label>
                                        <label class="mt-checkbox" style="width: 80px;">
                                            <input type="checkbox" name="openWeek" value="7" {if condition="(in_array(7, $info.openWeek))"} checked {/if}> 周日
                                            <span></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">

                                    </label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" id="startTime" name="startTime" value="{$info.startTime}" placeholder="开始时间" autocomplete="off" readonly>
                                    </div>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" id="endTime" name="endTime" value="{$info.endTime}" placeholder="结束时间" autocomplete="off" readonly>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        联系电话
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-4">
                                        <input type="text" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^0-9(\-)]/g,'')}else{this.value=this.value.replace(/[^0-9(\-)]/g,'')}" class="form-control" id="phone" data-required="1" name="phone" value="{$info.phone}">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" name="id" value="{$info.id}">

                        <hr />
                        <div class="row">
                            <div class="form-actions">
                                <div class="col-md-offset-2 col-md-10">
                                    <button type="button" id="form-submit" class="btn blue save-btn">
                                        保存 <i class="fa fa-floppy-o"></i>
                                    </button>
                                    <button type="button" class="btn default" onclick="history.go(-1);">
                                        返回 <i class="fa fa-mail-forward"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">

<input type="hidden" class="save_url" value="{:url('admin/'.strtolower($model).'/editpost')}">
<input type="hidden" class="checkName_url" value="{:url('admin/'.strtolower($model).'/checkName')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/plugins/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<script src="__STATIC__/admin/js/qiniu/plupload.full.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniu.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/custom.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniuConfig.js" type="text/javascript"></script>

<script src="https://api.map.baidu.com/api?v=2.0&ak=07E2669c3b77a0793274952ba61cd8b8&s=1" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/uploadfile.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/store.js" type="text/javascript"></script>
{/block}